#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime

from pydantic import BaseModel
from typing import Optional, TypeVar, Generic, Union

from pydantic.generics import GenericModel

from app.db.base_class import Base

CTM = TypeVar("CTM", bound=Union[BaseModel, Base, int, float, datetime, bool])


class CeleryTaskMsg(GenericModel, Generic[CTM]):
    msgId: str
    msgDate: datetime
    msgBody: Optional[CTM]

    class Config:
        arbitrary_types_allowed = True
